#ifndef DOPPLERDataView_H
#define DOPPLERDataView_H

#include <QWidget>
#include <QGraphicsItem>
#include <QPair>
#include <QSize>
class DopplerRulerBar      ;
class DopplerTitleBar      ;
class DopplerColorBar      ;
class DopplerGraphicView   ;
class DopplerColorIndex    ;
class DopplerDrawScan      ;
class QGraphicsItem        ;
class QGridLayout          ;



class DopplerDataView : public QWidget
{

    Q_OBJECT
public:
    enum DATA_VIEW_COMPONENT
    {
       DATA_VIEW_COMPONENT_NONE       =  0 ,
       DATA_VIEW_COMPONENT_TITLE      =  1 ,
       DATA_VIEW_COMPONENT_LEFTRULER  =  2 ,
       DATA_VIEW_COMPONENT_RIGHTRULER =  4 ,
       DATA_VIEW_COMPONENT_BOTTOMRULER=  8 ,
       DATA_VIEW_COMPONENT_COLORBAR   =  16,
       DATA_VIEW_COMPONENT_ALL        =  0xFFFF
    } ;

    enum DATA_VIEW_RULER
    {
        DATA_VIEW_RULER_LEFT = 0 ,
        DATA_VIEW_RULER_RIGHT ,
        DATA_VIEW_RULER_BOTTOM ,
        DATA_VIEW_RULER_MAX
    };


    explicit DopplerDataView(QWidget *parent = 0 , DATA_VIEW_COMPONENT eComponent_ = DATA_VIEW_COMPONENT_ALL);
    ~DopplerDataView();
    void DeleteAllWidget();
    QSize GetViewSize();
    void EnableComponent(DATA_VIEW_COMPONENT eComponent_);
    void SetRulerRange(double nStart_ , double nStop_ , DATA_VIEW_RULER eRuler_ ) ;
    void SetRulerColor(QColor* color , DATA_VIEW_RULER eRuler_ ) ;
    void SetRulerMarkerColor(QColor* color , DATA_VIEW_RULER eRuler_ ) ;
    void SetRulerUnit(QString* unit  , DATA_VIEW_RULER eRuler_) ;
    void SetTitleBarColor(QColor* color_) ;
    void SetTitleBarString(QString* str_)  ;
    void SetTitleBarStringColor(QColor* color_) ;
    void SetColorBarColorIndex (DopplerColorIndex* index)              ;
    void AddOverlayItems(QGraphicsItem* item_);
    void SetDrawScan(DopplerDrawScan* pDraw_)  ;
private:
    void CreateComponent();
    void RangeTransfer(QPair<double , double> range_ , QPair<double , double>* pos_) ;
    void resizeEvent(QResizeEvent *) ;
private:
    QGridLayout* m_pLayout           ;
    DopplerRulerBar* m_pRulers[DATA_VIEW_RULER_MAX]  ;
    DopplerTitleBar* m_pTitleBar     ;
    DopplerColorBar* m_pColorBar     ;
    DopplerGraphicView* m_pGraphicView ;
    DATA_VIEW_COMPONENT m_eComponent ;

    QPair<double , double>  RulerRange[4];

    enum ITEMS_TYPE
    {
        ITEMS_TYPE_LINE  = 0 ,
        ITEMS_TYPE_GATE      ,
        ITEMS_TYPE_CURSOR    ,
        ITEMS_TYPE_PART      ,
        ITEMS_TYPE_THICKNESS ,
        ITEMS_TYPE_MAX
    } ;
    //QList<QGraphicsItem> items[ITEMS_TYPE_MAX];
signals:

public slots:
    void slotZoonAction(QRectF rect) ;
};

#endif // DOPPLERDataView_H
